package a.f.n;

import a.c.d;
import a.c.e;
import a.c.m;
import a.d.f;
import a.d.w;
import a.f.cd;
import a.f.o;
import a.f.zc;
import a.i.p;

import java.util.Comparator;

public class q
  extends k
{
  public static final Object o = "y.layout.tree.GridNodePlacer.GRID_DPKEY";
  private k.c_ p;
  public static boolean q;
  
  public q()
  {
    this(k.b_.a);
  }
  
  public q(k.b_ paramb_)
  {
    this(paramb_, k.c_.d);
  }
  
  public q(k.b_ paramb_, k.c_ paramc_)
  {
    super(paramb_);
    this.p = paramc_;
  }
  
  protected byte d(e parame)
  {
    return 0;
  }
  
  protected v a(e parame, byte paramByte)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    v localv1 = a(parame);
    if (!bool2) {
      if (parame.e() == 0)
      {
        a(parame, paramByte, localv1);
        return localv1;
      }
    }
    a.c.k localk = parame.g().c(o);
    if (!bool2) {}
    c_ localc_ = localk != null ? localk : new c_(null);
    parame.b(new Comparator()
    {
      private final a.c.k val$rowProvider;
      
      public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
      {
        boolean bool = k.n;
        e locale1 = ((d)paramAnonymousObject1).f();
        e locale2 = ((d)paramAnonymousObject2).f();
        int i = this.val$rowProvider.getInt(locale1);
        int j = this.val$rowProvider.getInt(locale2);
        if (!bool)
        {
          if (i == j) {
            return 0;
          }
          if (bool) {
            break label74;
          }
        }
        label74:
        return i < j ? -1 : 1;
      }
    });
    localv1.h(-localv1.d() - this.g);
    double d1 = -1.797693134862316E+308D;
    int i = localc_.getInt(parame.h().f());
    f localf1 = c(0.0D);
    f localf2 = c(0.0D);
    Object localObject1 = null;
    Object localObject2 = null;
    Object localObject3 = parame.n();
    Object localObject7;
    do
    {
      if (!((m)localObject3).e()) {
        break;
      }
      localObject4 = ((m)localObject3).a();
      localObject5 = ((d)localObject4).f();
      int j = localc_.getInt(localObject5);
      if (bool2) {
        break label408;
      }
      if (bool1) {
        break label399;
      }
      if (j > i)
      {
        localf2 = c(d1 + this.g);
        localf1 = c(0.0D);
      }
      i = j;
      localObject7 = b((e)localObject5);
      if (!bool2)
      {
        if (localObject1 == null) {
          localObject1 = localObject7;
        }
        localObject2 = localObject7;
        ((v)localObject7).e(localf2, this.g);
      }
      double d2 = ((v)localObject7).c();
      ((v)localObject7).a(3).a(0.0D, d2, ((v)localObject7).b());
      ((v)localObject7).d(localf1, this.g);
      double d3 = ((v)localObject7).b();
      localf1.b(0.0D, d2, d3);
      ((v)localObject7).e(localf1);
      ((v)localObject7).n();
      d1 = Math.max(d1, ((v)localObject7).d());
      ((m)localObject3).f();
    } while (!bool1);
    this.p.a(localv1, this.l, this.g);
    localv1.n();
    d1 = -1.797693134862316E+308D;
    if (!bool2)
    {
      label399:
      i = localc_.getInt(parame.h().f());
      localf2 = c(0.0D);
    }
    label408:
    Object localObject5 = new db.c_(new w(0.0D, localf2.d() - localv1.p() / 2.0D - this.g));
    localObject3 = new db.c_(new w(0.0D, localf2.d()));
    Object localObject4 = new db.c_(new w(localObject1.h() / 2.0D, 0.0D));
    Object localObject6 = parame.n();
    do
    {
      if (!((m)localObject6).e()) {
        break;
      }
      localObject7 = ((m)localObject6).a();
      e locale = ((d)localObject7).f();
      if (bool2) {
        break label692;
      }
      v localv2 = b(locale);
      int k = localc_.getInt(locale);
      if (bool1) {
        break label690;
      }
      if (!bool2)
      {
        if (k > i) {
          localObject3 = new db.c_(new w(0.0D, localf2.d() + d1 + this.g));
        }
      }
      else {
        i = k;
      }
      db.a_ locala_ = a((d)localObject7, localv2);
      locala_.a((db.c_)localObject3);
      locala_.a((db.c_)localObject4);
      locala_.a((db.c_)localObject5);
      locala_.f(1);
      locala_.e(2);
      locala_.f(3);
      locala_.h();
      d1 = Math.max(d1, localv2.d());
      ((m)localObject6).f();
    } while (!bool1);
    if (!bool2) {
      localv1.a(this.l);
    }
    label690:
    label692:
    if (!bool2)
    {
      if (localObject1 != null)
      {
        localObject6 = new f(Math.min(localv1.h(), localObject1.b()), Math.max(localv1.g(), localObject2.b()), localObject1.c());
        localv1.m((f)localObject6);
      }
      a(parame, paramByte, localv1);
    }
    return localv1;
  }
  
  private f c(double paramDouble)
  {
    return new f(-1.797693134862316E+308D, 1.7976931348623157E+308D, paramDouble);
  }
  
  public Comparator a()
  {
    new Comparator()
    {
      public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
      {
        boolean bool = k.n;
        e locale1 = ((d)paramAnonymousObject1).f();
        e locale2 = ((d)paramAnonymousObject2).f();
        a.c.q localq = locale1.g();
        a.c.k localk = localq.c(q.o);
        if (!bool) {}
        q.c_ localc_ = localk != null ? localk : new q.c_(null);
        int i = localc_.getInt(locale1);
        int j = localc_.getInt(locale2);
        if (!bool)
        {
          if (i == j)
          {
            o localo = (o)localq;
            zc localzc1 = localo.d(locale1);
            zc localzc2 = localo.d(locale2);
            w localw1 = k.a(q.this.i, new w(localo.p(locale1), localo.q(locale1)));
            w localw2 = k.a(q.this.i, new w(localo.p(locale2), localo.q(locale2)));
            if (!bool) {
              if (localw1.a < localw2.a) {
                return -1;
              }
            }
            return 1;
          }
          if (bool) {
            break label220;
          }
        }
        label220:
        return i < j ? -1 : 1;
      }
    };
  }
  
  private void a(e parame, byte paramByte, v paramv)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    if (parame.i() == null) {
      return;
    }
    cd localcd = c(parame);
    db.b_ localb_ = a(parame, paramv);
    if (!bool2)
    {
      switch (paramByte)
      {
      case 0: 
        if (!bool2)
        {
          switch (localcd.b())
          {
          case 1: 
            localb_.d(0, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break label573;
            }
          case 3: 
          case 4: 
          case 5: 
          case 6: 
          case 7: 
          default: 
            if (!bool2) {
              if (!bool1) {
                break label573;
              }
            }
          case 2: 
            localb_.e(0, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break label573;
            }
          }
          localb_.c(0, true);
          localb_.d(1, true);
          if (bool2) {
            return;
          }
        }
        if (!bool1) {
          break;
        }
      case 1: 
        if (!bool2)
        {
          switch (localcd.b())
          {
          case 1: 
          case 3: 
          case 5: 
          case 6: 
          case 7: 
          default: 
            if (!bool2) {
              if (!bool1) {
                break label573;
              }
            }
          case 4: 
            localb_.b(0, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break label573;
            }
          case 2: 
            localb_.e(0, true);
            localb_.b(0, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break label573;
            }
          }
          localb_.c(0, true);
          if (bool2) {
            return;
          }
        }
        if (!bool1) {
          break;
        }
      case 2: 
        if (!bool2) {
          switch (localcd.b())
          {
          case 1: 
            localb_.d(0, true);
            localb_.c(1, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break;
            }
          case 3: 
          case 4: 
          case 5: 
          case 6: 
          case 7: 
          default: 
            localb_.b(1, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break;
            }
          case 2: 
            localb_.e(0, true);
            localb_.b(1, true);
            if (bool2) {
              return;
            }
            if (!bool1) {
              break;
            }
          case 8: 
            localb_.c(1, true);
            if (bool2) {
              return;
            }
            break;
          }
        } else {
          if (!bool1) {
            break;
          }
        }
        break;
      case 3: 
        if (!bool2) {}
        switch (localcd.b())
        {
        case 1: 
          localb_.d(0, true);
          if (bool2) {
            return;
          }
          if (!bool1) {
            break;
          }
        case 4: 
          localb_.b(0, true);
          localb_.d(0, true);
          if (bool2) {
            return;
          }
          if (!bool1) {
            break;
          }
        case 2: 
          localb_.e(0, true);
          if (bool2) {
            return;
          }
          if (bool1) {
            break;
          }
        }
        break;
      }
      label573:
      paramv.l();
    }
  }
  
  public k.c_ e()
  {
    return this.p;
  }
  
  public void a(k.c_ paramc_)
  {
    this.p = paramc_;
  }
  
  private static final class c_
    extends p
  {
    private c_() {}
    
    public int getInt(Object paramObject)
    {
      return 0;
    }
    
    c_(q.0 param0)
    {
      this();
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.n.q

 * JD-Core Version:    0.7.0.1

 */